package ru.ognick.logic;

import ru.ognick.locale.ILocale;
import ru.ognick.locale.Locale;

public class Praxis {
//	public static final String TITLE = "TITLE";
	final private static ILocale L = Locale.get();
	
	public enum PraxisType
	{
		action,
		passive
	}
	
	static public String[] praxisTypeStringArray(){
		PraxisType[] praxisTypes = PraxisType.values();
		String[] values = new String[praxisTypes.length];
		for (int i = 0; i < praxisTypes.length; i++)
			values[i] =  L.G_Praxis(praxisTypes[i]);
		return values;
	}
	
	private PraxisType praxisType;
	private String title;
	private String content;
	private int timeSpan;
	private int periodSignal;
	private int timePreload;
	private String media;
	
	public Praxis(){
		this.setPraxisType(PraxisType.passive); 
		this.setTimeSpan(0);
		this.setPeriodSignal(0);
		this.setTimePreload(0);
		this.setMedia("");
	}
	
	public Praxis(
			PraxisType praxisType, 
			String title, 
			String content, 
			int timeSpan ,
			int periodSignal,
			int timePreload,
			String media 
		) 
	{
		savePraxis(praxisType, title, content, timeSpan, periodSignal, timePreload, media);
	}
	
	public void savePraxis(
			PraxisType praxisType, 
			String title, 
			String content, 
			int timeSpan ,
			int periodSignal,
			int timePreload,
			String media 
		) 
	{
		this.setTitle(title); 
		this.setContent(content); 
		this.setTimeSpan(timeSpan);
		this.setPeriodSignal(periodSignal);
		this.setTimePreload(timePreload);
		this.setMedia(media);
		this.setPraxisType(praxisType);
	}
	
	
	public void setPraxisType(PraxisType praxisType) {
		this.praxisType = praxisType;
		if (praxisType == PraxisType.passive) {
			this.setTitle(null); 
			this.setContent(null);
		}
	}
	public PraxisType getPraxisType() {
		return praxisType;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getTitle() {
		return title;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getContent() {
		return content;
	}
	public void setTimeSpan(int timeSpan) {
		this.timeSpan = timeSpan;
	}
	public int getTimeSpan() {
		return timeSpan;
	}
	public void setPeriodSignal(int periodSignal) {
		this.periodSignal = periodSignal;
	}
	public int getPeriodSignal() {
		return periodSignal;
	}
	public void setTimePreload(int timePreload) {
		this.timePreload = timePreload;
	}
	public int getTimePreload() {
		return timePreload;
	}
	public void setMedia(String media) {
		this.media = media;
	}
	public String getMedia() {
		return media;
	}
	
}
